#-*- coding:utf-8 -*-
import os
import sys
import re

if __name__ == '__main__':
    handler = sys.stdin
    word_dict = {}
    for line in handler:
        if not line:
            continue
        terms = line.strip().split(' ')
        for i in terms:
            if i in word_dict:
                word_dict[i] += 1
            else:
                word_dict[i] = 1
        for j in word_dict:
            print(j,word_dict[i])